package com.hcl.orm.sample;

import com.hcl.orm.core.executor.page.PageParam;
import com.hcl.orm.core.executor.page.PageResult;
import com.hcl.orm.sample.dao.BusinentrustDAO;
import com.hcl.orm.sample.dao.CustomerAgencyDao;
import com.hcl.orm.sample.domain.Businentrust;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.List;

/**
 * @author hucl
 * @projectName hcl-orm
 * @description: 自定义SQL执行
 * @date 2021/8/1214:14
 */
public class CustomerDaoSample {
    private static final Logger logger = LoggerFactory.getLogger(CustomerDaoSample.class);
    private ConfigurableApplicationContext context;
    private BusinentrustDAO businentrustDAO;

    public CustomerDaoSample(ConfigurableApplicationContext context) {
        this.context = context;
        businentrustDAO = context.getBean(BusinentrustDAO.class);
    }

    public void getBusinessEntrust() {
        Businentrust ret = businentrustDAO.getBusinEntrustByAllotNo("6052021050703000100018721");
        logger.info("getBusinessEntrust 调用成功，结果为:" + ret);
    }

    public void getBusinessEntrustByInitDate() {
        List<Businentrust> ret = businentrustDAO.getBusinentrustRecord(20210810);
        logger.info("getBusinessEntrustByInitDate 调用成功，结果为:" + ret);
    }

    public void getBusinentrustQueryPage() {
        PageResult<Businentrust> ret = businentrustDAO.getBusinentrustWithdraw(
                new PageParam(10, 1), "00002200", null
                , "C90", null);
        logger.info("getBusinentrustQueryPage 调用成功，结果为:" + ret);
    }

    public void getFundAccountList() {
        List<String> ret = businentrustDAO.getFundAccountList();
        logger.info("getFundAccountList 调用成功，结果为:" + ret);
    }
}
